All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface sun.server.util.Cacheable

public interface Cacheable
All objects that are required to be cached in the LRUCache must implement the cache interface.

See Also:
LRUCache

Method Index

 o getContext()
Retrieve the object that was set in the setContext method.
 o replaceNotify()
The notify method is called when an object is being considered for replacement in the cache.
 o setContext(Object)
For efficent performance of the LRUCache, it requires the Cacheable object to be able set and retrieve an opaque context object that is used by the LRUCache.
 o size()
This is the size of this object in bytes.

Methods

 o size
 public abstract int size()
This is the size of this object in bytes. When an object is inserted in an LRUCache, it checks to see if the size can be accomodated. If not it makes space by throwing out the LRU elements until space is available. If all else fails, an OutOfMemory exception is thrown.

 o setContext
 public abstract void setContext(Object o)
For efficent performance of the LRUCache, it requires the Cacheable object to be able set and retrieve an opaque context object that is used by the LRUCache.

Parameters:
an - opaque context that is passed in by the cache
See Also:
getContext
 o getContext
 public abstract Object getContext()
Retrieve the object that was set in the setContext method. For efficent performance of the LRUCache, it requires the Cacheable object to be able set and retrieve an opaque context object that is used by the LRUCache.

Returns:
the context object that the cache set in the setContext method.
See Also:
setContext
 o replaceNotify
 public abstract boolean replaceNotify()
The notify method is called when an object is being considered for replacement in the cache. If this method returns false, the object is NOT replaced in the cache instead the next replacement candidate is chosen. If this method returns true, the object is replaced in the cache. Unilaterally returning false from this object is would certainly lead to an OutOfMemory exception. Unilaterally returning true from this method would result in correct LRU behaviour.

Returns:
- true if the object should be replaced, false if the object should not be replaced.

All Packages  Class Hierarchy  This Package  Previous  Next  Index